<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title></title>
    <link rel="stylesheet" href="../public/layui/css/layui.css"/>
    <link rel="stylesheet" href="../css/mycss.css"/>
    <script src="../public/layui/layui.js"></script>
</head>
<body>

<div class="client-container">
    <form class="layui-form" action="">
        <div class="layui-form-item center">
            <div class="layui-inline">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-inline">
                    <input type="text" name="realName" lay-verify="required" autocomplete="off" class="layui-input"/>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">电话</label>
                <div class="layui-input-inline">
                    <input value="18262893421" type="tel" name="telephone" lay-verify="required|phone" autocomplete="off" class="layui-input"/>
                </div>
            </div>
            <button id="search" type="submit" class="layui-icon layui-btn layui-btn-normal" lay-submit="" lay-filter="demo1">&#xe615;搜索</button>
        </div>
    </form>
    <ul class="book-list">

    </ul>
    <div class="center" id="page"></div>
</div>

<div class="blank"></div>
<script>
    layui.use(['laypage','jquery','form'], function() {
        var laypage = layui.laypage;
        let $ = layui.jquery;
        let form = layui.form;
        //完整功能
        laypage.render({
            elem: 'page'
            , count: 100
            , layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
            , jump: function (obj) {
                console.log(obj)
            }
        });

        form.on('submit(demo1)', function(data){
            // 将data中的数据取出发送ajax请求
            $.ajax({
                url: '/hotal/front/reserve/search',
                type: 'POST',
                dataType: 'json',
                contentType: 'application/json;charset=UTF-8',
                data: JSON.stringify(data.field),
                success: function (data, status) {
                    console.log('返回的结果是', data)
                }
            });
            // if (method === 0 || method === 1) {
            //     // 如果当前是普通用户订购
            //     $.ajax({
            //         url: "/hotal/front/reserve/house",
            //         type: 'POST',
            //         dataType:'json',
            //         contentType:'application/json;charset=UTF-8',
            //         data:JSON.stringify(data.field),
            //         success:function(data, status){
            //             if (data.code === 200) {
            //                 layer.alert('预定成功');
            //             }else if (data.code === 500) {
            //                 layer.alert(data.data);
            //             }
            //         }
            //     });
            // } else if (method === 2) {
            //     // 如果当前是2就是团购订购
            //
            // }

            return false;
        });


    })

</script>
</body>
</html>